Skip to content

Add tests#110

Merged
RogerPodacter merged 1 commit into
evm-backend-demofrom
add_tests
Sep 23, 2025
Merged

Add tests#110
RogerPodacter merged 1 commit into
evm-backend-demofrom
add_tests

Conversation

@RogerPodacter

Copy link
Copy Markdown
Member

No description provided.

@RogerPodacter RogerPodacter merged commit 1a829b1 into evm-backend-demo Sep 23, 2025
1 of 2 checks passed
@RogerPodacter RogerPodacter deleted the add_tests branch September 23, 2025 22:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive integration tests for the Ethscriptions system, including creation and transfer scenarios, along with test infrastructure to support these tests.

  • Adds a comprehensive test helper module with DSL for creating mock L1 blocks and transactions
  • Implements integration tests for ethscription creation via input and events (ESIP-3)
  • Adds integration tests for various transfer mechanisms (input, events, ESIP-1, ESIP-2, ESIP-5)

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
spec/support/ethscriptions_test_helper.rb Test helper module providing DSL and mock infrastructure for L1/L2 testing
spec/integration/ethscriptions_creation_spec.rb Integration tests for ethscription creation scenarios
spec/integration/ethscription_transfers_spec.rb Integration tests for ethscription transfer scenarios
app/services/eth_block_importer.rb Minor change to expose prefetcher attribute for testing

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

original_methods = {}

# Stub the SysConfig methods and store originals
%w[esip1_enabled? esip2_enabled? esip3_enabled? esip5_enabled? esip7_enabled?].each do |method|

Copilot AI Sep 23, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using string array with %w[] for method names makes this code brittle to refactoring. Consider defining these method names as constants or using symbols to make them easier to find and maintain.

Copilot uses AI. Check for mistakes.
end

def build_l1_transaction(descriptor, index)
# binding.irb

Copilot AI Sep 23, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove debugging code (binding.irb) that was left in the codebase.

Suggested change
# binding.irb

Copilot uses AI. Check for mistakes.
Comment on lines +521 to +525
mock_ethereum_client = instance_double(EthRpcClient,
get_block_number: block_number,
get_block: block_data,
get_transaction_receipts: receipts_data
)

Copilot AI Sep 23, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable mock_ethereum_client is declared twice (lines 519 and 521), with the first declaration being unused. Remove the duplicate declaration on line 519.

Copilot uses AI. Check for mistakes.
end

# Convert hex strings to integers where appropriate
%w[blockNumber gasUsed cumulativeGasUsed effectiveGasPrice status transactionIndex nonce value gas depositNonce mint depositReceiptVersion gasPrice].each do |key|

Copilot AI Sep 23, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hardcoded list of field names for hex conversion is brittle and difficult to maintain. Consider defining these as a constant or using a more systematic approach to identify hex fields.

Copilot uses AI. Check for mistakes.
]
)
])
# binding.irb

Copilot AI Sep 23, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove debugging code (binding.irb) that was left in the codebase.

Suggested change
# binding.irb

Copilot uses AI. Check for mistakes.
it "transfers via event (happy path)" do
# Setup: create ethscription
id1 = create_test_ethscription(creator: alice, to: alice, content: "Test content2a")
# binding.irb

Copilot AI Sep 23, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove debugging code (binding.irb) that was left in the codebase.

Suggested change
# binding.irb

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants